<?php /* Smarty version Smarty-3.1.18, created on 2015-07-25 14:03:50
         compiled from "D:\WWW\yf_qiaqia\Admin\View\Wxrule\rule.html" */ ?>
<?php /*%%SmartyHeaderCode:27033559cd4c4654355-62153254%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '422faff60e323f1a131c17eb70ff616451d7c564' => 
    array (
      0 => 'D:\\WWW\\yf_qiaqia\\Admin\\View\\Wxrule\\rule.html',
      1 => 1437790610,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '27033559cd4c4654355-62153254',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.18',
  'unifunc' => 'content_559cd4c492ad04_61219741',
  'variables' => 
  array (
    '_C' => 0,
    'rule' => 0,
    'action' => 0,
    'img' => 0,
    'art_list' => 0,
    'list' => 0,
    '_L' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_559cd4c492ad04_61219741')) {function content_559cd4c492ad04_61219741($_smarty_tpl) {?><!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="<?php echo $_smarty_tpl->tpl_vars['_C']->value['hy_path'];?>
css/amazeui.min.css" />
		<link rel="stylesheet" type="text/css" href="<?php echo $_smarty_tpl->tpl_vars['_C']->value['hy_path'];?>
css/hy.admin.css" />
	</head>

	<body>
		<div class="am-g">
			<?php echo $_smarty_tpl->getSubTemplate ('../Common/hy_header.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>

			<div class="am-u-md-8 am-u-end">
				<form class="am-form am-form-horizontal hy-js-form">
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">标题:</label>
						<div class="am-u-sm-9">
							<input type="text" name="name" value="<?php echo $_smarty_tpl->tpl_vars['rule']->value['name'];?>
" placeholder="选填">
						</div>
					</div>
					<?php if ($_smarty_tpl->tpl_vars['action']->value=='create_rule') {?>
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">关键词:</label>
						<div class="am-u-sm-9">
							<input type="text" name="keyword" value="<?php echo $_smarty_tpl->tpl_vars['rule']->value['keyword'];?>
" placeholder="选填">
						</div>
					</div>
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">类型:</label>
						<div data-am-button class="am-btn-group am-u-sm-9 hy-js-menutab">
							<label data-target="#link1" class="hy-js-menubtn am-btn am-btn-default am-btn-xs <?php if ($_smarty_tpl->tpl_vars['rule']->value['type']) {?><?php if ($_smarty_tpl->tpl_vars['rule']->value['type']==1) {?> am-active <?php } else { ?><?php }?><?php } else { ?> am-active <?php }?> ">
								<input type="radio" <?php if ($_smarty_tpl->tpl_vars['rule']->value['type']) {?><?php if ($_smarty_tpl->tpl_vars['rule']->value['type']==1) {?> checked="checked" <?php } else { ?><?php }?><?php } else { ?> checked="checked" <?php }?> name="type" value="1" id="option1">文字
							</label>
							<label data-target="#link2" class="hy-js-menubtn am-btn am-btn-default am-btn-xs <?php if ($_smarty_tpl->tpl_vars['rule']->value['type']==2) {?> am-active <?php } else { ?><?php }?> ">
								<input type="radio" name="type" <?php if ($_smarty_tpl->tpl_vars['rule']->value['type']==2) {?> checked="checked" <?php } else { ?><?php }?> value="2" id="option2"> 图文
							</label>
						</div>
					</div>
					<?php }?>
					<div id="link1" <?php if ($_smarty_tpl->tpl_vars['rule']->value['type']) {?><?php if ($_smarty_tpl->tpl_vars['rule']->value['type']==1) {?>style="" <?php } else { ?>style="display:none;" <?php }?><?php } else { ?>style="" <?php }?> class="hy-js-menupanel am-form-group">
						<div class="am-form-group">
							<label for="user-name" class="am-u-sm-3 am-form-label">内容:</label>
							<div class="am-u-sm-9">
								<textarea rows="3" name="content"><?php echo $_smarty_tpl->tpl_vars['rule']->value['content'];?>
</textarea>
							</div>
						</div>
					</div>
					<div id="link2" <?php if ($_smarty_tpl->tpl_vars['rule']->value['type']==2) {?>style="" <?php } else { ?> style="display:none" <?php }?> class="hy-js-menupanel am-form-group">
						<div class="am-tabs am-margin" data-am-tabs="">
							<ul class="am-tabs-nav am-nav am-nav-tabs am-u-sm-9 am-u-sm-offset-3 hy-js-imgtab">
								<li data-id='1' class="am-active"><a hidefocus="true" href="#tab1">新增 <span class="am-icon-plus hy-js-addimg"></span></a>
								</li>
								<?php  $_smarty_tpl->tpl_vars['img'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['img']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['rule']->value['pic_img']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
 $_smarty_tpl->tpl_vars['smarty']->value['foreach']['img']['iteration']=0;
 $_smarty_tpl->tpl_vars['smarty']->value['foreach']['img']['index']=-1;
foreach ($_from as $_smarty_tpl->tpl_vars['img']->key => $_smarty_tpl->tpl_vars['img']->value) {
$_smarty_tpl->tpl_vars['img']->_loop = true;
 $_smarty_tpl->tpl_vars['smarty']->value['foreach']['img']['iteration']++;
 $_smarty_tpl->tpl_vars['smarty']->value['foreach']['img']['index']++;
?> <?php if ($_smarty_tpl->getVariable('smarty')->value['foreach']['img']['index']!=0) {?>
								<li data-id='<?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['img']['iteration'];?>
' class="am-active"><a hidefocus="true" href="#tab<?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['img']['iteration'];?>
">图文<?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['img']['iteration'];?>
<span data-id="<?php echo $_smarty_tpl->tpl_vars['img']->value['id'];?>
" class="am-icon-close hy-js-closetab"></span></a>
								</li>
								<?php }?> <?php } ?>
							</ul>
							<!--list  -->

							<div class="am-tabs-bd  am-u-sm-9 am-u-sm-offset-3 hy-js-imgarea">
								<?php if ($_smarty_tpl->tpl_vars['rule']->value['pic_img']) {?> <?php  $_smarty_tpl->tpl_vars['img'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['img']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['rule']->value['pic_img']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
 $_smarty_tpl->tpl_vars['smarty']->value['foreach']['img']['iteration']=0;
 $_smarty_tpl->tpl_vars['smarty']->value['foreach']['img']['index']=-1;
foreach ($_from as $_smarty_tpl->tpl_vars['img']->key => $_smarty_tpl->tpl_vars['img']->value) {
$_smarty_tpl->tpl_vars['img']->_loop = true;
 $_smarty_tpl->tpl_vars['smarty']->value['foreach']['img']['iteration']++;
 $_smarty_tpl->tpl_vars['smarty']->value['foreach']['img']['index']++;
?>
								<div class="am-tab-panel am-fade am-active am-in" id="tab<?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['img']['iteration'];?>
">
									<div class="am-form-group">
										<label for="user-name" class="am-u-sm-2 am-form-label">标题:</label>
										<div class="am-u-sm-10">
											<input type="text" name="field<?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['img']['iteration'];?>
" value="<?php echo $_smarty_tpl->tpl_vars['img']->value['title'];?>
">
										</div>
									</div>
									<div class="am-form-group">
										<label for="user-name" class="am-u-sm-2 am-form-label">描述:</label>
										<div class="am-u-sm-10">
											<textarea name="field<?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['img']['iteration'];?>
" rows="3" cols=""><?php echo $_smarty_tpl->tpl_vars['img']->value['description'];?>
</textarea>
										</div>
									</div>
									<div class="am-form-group">
										<label for="user-name" class="am-u-sm-2 am-form-label">链接:</label>
										<div class="am-u-sm-6">
											<input type="text" name="field<?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['img']['iteration'];?>
" value="<?php echo $_smarty_tpl->tpl_vars['img']->value['url'];?>
">
										</div>
										<div class="am-u-sm-4">
											<select class="hy-js-linkart">
												<option value="0">关联本站文章</option>
												<?php  $_smarty_tpl->tpl_vars['list'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['list']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['art_list']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['list']->key => $_smarty_tpl->tpl_vars['list']->value) {
$_smarty_tpl->tpl_vars['list']->_loop = true;
?>
												<option value="<?php echo $_smarty_tpl->tpl_vars['list']->value['url'];?>
"><?php echo $_smarty_tpl->tpl_vars['list']->value['title'];?>
</option>
												<?php } ?>
											</select>
										</div>
									</div>
									<div class="am-form-group">
										<label for="user-name" class="am-u-sm-2 am-form-label">缩略图:</label>
										<div class="am-u-sm-6">
											<input type="text" name="field<?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['img']['iteration'];?>
" class="am-input-sm img-js-imgurl" value="<?php echo $_smarty_tpl->tpl_vars['img']->value['thumb'];?>
">

										</div>
										<div class="am-u-sm-2">
											<img id="hy-thumb" class="hy-thumb" style="height: 30px;" <?php if ($_smarty_tpl->tpl_vars['img']->value['thumb']) {?>src="<?php echo $_smarty_tpl->tpl_vars['img']->value['thumb'];?>
" <?php } else { ?> src="<?php echo $_smarty_tpl->tpl_vars['_C']->value['hy_path'];?>
images/logo2.png" <?php }?>>
										</div>
										<div class="am-u-sm-2">
											<button class="am-btn am-btn-primary am-btn-xs hy-js-uploadimg">上传</button>
										</div>
									</div>
										<input type="hidden" name="field<?php echo $_smarty_tpl->getVariable('smarty')->value['foreach']['img']['iteration'];?>
"  value="<?php echo $_smarty_tpl->tpl_vars['img']->value['id'];?>
" />
								</div>
							
								<?php } ?> <?php } else { ?>
								<div class="am-tab-panel am-fade am-active am-in" id="tab1">
									<div class="am-form-group">
										<label for="user-name" class="am-u-sm-2 am-form-label">标题:</label>
										<div class="am-u-sm-10">
											<input type="text" name="field" value="">
										</div>
									</div>
									<div class="am-form-group">
										<label for="user-name" class="am-u-sm-2 am-form-label">描述:</label>
										<div class="am-u-sm-10">
											<textarea name="field" rows="3" cols=""></textarea>
										</div>
									</div>
									<div class="am-form-group">
										<label for="user-name" class="am-u-sm-2 am-form-label">链接:</label>
										<div class="am-u-sm-6">
											<input type="text" name="field" value="">
										</div>
										<div class="am-u-sm-4">
											<select class="hy-js-linkart">
												<option value="0">关联本站文章</option>
												<?php  $_smarty_tpl->tpl_vars['list'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['list']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['art_list']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['list']->key => $_smarty_tpl->tpl_vars['list']->value) {
$_smarty_tpl->tpl_vars['list']->_loop = true;
?>
												<option value="<?php echo $_smarty_tpl->tpl_vars['list']->value['url'];?>
"><?php echo $_smarty_tpl->tpl_vars['list']->value['title'];?>
</option>
												<?php } ?>
											</select>
										</div>
									</div>
									<div class="am-form-group">
										<label for="user-name" class="am-u-sm-2 am-form-label">缩略图:</label>
										<div class="am-u-sm-6">
											<input type="text" name="field" class="am-input-sm img-js-imgurl" value="">

										</div>
										<div class="am-u-sm-2">
											<img id="hy-thumb" class="hy-thumb" style="height: 30px;"  src="<?php echo $_smarty_tpl->tpl_vars['_C']->value['hy_path'];?>
images/logo2.png" >
										</div>
										<div class="am-u-sm-2">
											<button class="am-btn am-btn-primary am-btn-xs hy-js-uploadimg">上传</button>
										</div>
									</div>
								</div>
								<?php }?>
							</div>
						</div>
					</div>

					<div class="am-form-group">
						<div class="am-u-sm-9 am-u-sm-push-3">
							<input type="hidden" name="id" value="<?php echo $_smarty_tpl->tpl_vars['rule']->value['id'];?>
" />
							<button type="button" class="am-btn am-btn-primary hy-js-submit"><?php echo $_smarty_tpl->tpl_vars['_L']->value['SAVE'];?>
</button>
						</div>
					</div>
				</form>
			</div>
		</div>
		<?php echo $_smarty_tpl->getSubTemplate ('../Common/hy_footer.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>

		<script type="text/javascript" src="<?php echo $_smarty_tpl->tpl_vars['_C']->value['hy_path'];?>
js/editor/kindeditor.js"></script>
		<script type="text/javascript">
			$('.hy-js-imgtab li').live('click',function(){
			    	 $('.hy-js-imgtab li').removeClass('am-active');
			    	$(this).addClass('am-active');
			    	
			    })
			     $('.hy-js-imgtab a').live('click',function(e){
			     	e.preventDefault();
			     	
			    	var tab=$(this).attr('href');
			    	
			    	var hasclass=$(tab).hasClass('am-active am-in');
			    	console.log(hasclass);
			    	if(!hasclass)
			    	{
			    		$('.am-tabs-bd .am-tab-panel').each(function(){
			    			$(this).removeClass('am-active am-in');
			    		});
			    		$(tab).addClass('am-active am-in');
			    	}
			    });
			    $('.hy-js-linkart').live('change',function(){
			    	$(this).parent().parent().find('input').val($(this).val());
			    });
			    
			    $('.hy-js-closetab').live('click',function(){
			    	var tab=$(this).parent('a').attr('href');
			    	if(confirm('你确定要删除这条图文吗？'))
			    	{
			    		if(typeof($(this).attr('data-id'))!='undefined')
			    		{
			    			var id=$(this).attr('data-id');
			    			$.post('index.php?g=admin&m=wxrule&a=delimg',{ id:id},function(result){
			    				if(result.error==0)
			    				{
			    					$(this).parent('a').parent('li').remove();
			    	                $(tab).remove();
			    				}
			    				else
			    				{
			    					showMsg($result.content,1);
			    				}
			    			},'json')
			    		}
			    	   $(this).parent('a').parent('li').remove();
			    	   $(tab).remove();
			    	}
			    	
			    })
				hy_uploadimg('/rule', {}, function(result,_this) {
					if (typeof(result[0]) != 'undefined') {
						_this.parent().parent().find('.hy-thumb').attr('src', result[0]);
						_this.parent().parent().find('.img-js-imgurl').val(result[0]).focus();
					}
				});
				
				 hy_submit('index.php?g=admin&m=wxrule&a=<?php echo $_smarty_tpl->tpl_vars['action']->value;?>
');
				 
				 $('.hy-js-addimg').click(function(){
				 	var num=1;
				 	$('.hy-js-imgtab li').each(function(){
				 		num=$(this).attr('data-id')>num?$(this).attr('data-id'):num;
				 	})
				 	num++;
				 	var art_list=$('.hy-js-linkart').html();
				 	var html='<div class="am-tab-panel am-fade" id="tab'+num+'">';
				 	    html+='<div class="am-form-group"><label for="user-name" class="am-u-sm-2 am-form-label">标题:</label><div class="am-u-sm-10"><input type="text" name="field'+num+'" value=""></div></div>';
				 	    html+=' <div class="am-form-group"><label for="user-name" class="am-u-sm-2 am-form-label">描述:</label><div class="am-u-sm-10"><textarea name="field'+num+'" rows="3" cols=""></textarea></div></div>';
				 	    html+='<div class="am-form-group"><label for="user-name" class="am-u-sm-2 am-form-label">链接:</label><div class="am-u-sm-6"><input type="text" name="field'+num+'" value=""></div><div class="am-u-sm-4"><select class="hy-js-linkart">'+art_list+'</select></div></div>';
				 	    html+='<div class="am-form-group"><label for="user-name" class="am-u-sm-2 am-form-label">缩略图:</label><div class="am-u-sm-6"><input type="text" name="field'+num+'" class="am-input-sm img-js-imgurl" value=""></div><div class="am-u-sm-2"><img id="hy-thumb'+num+'" class="hy-thumb" style="height: 30px;" src="<?php echo $_smarty_tpl->tpl_vars['_C']->value['hy_path'];?>
images/logo2.png"></div> <div class="am-u-sm-2"><button class="am-btn am-btn-primary am-btn-xs hy-js-uploadimg" >上传</button></div></div>';
				 	    html+='</div>';
				 	  var tab='<li data-id="'+num+'" class=""><a hidefocus="true" href="#tab'+num+'">图文'+num+' <span class="am-icon-close hy-js-closetab"></span></a>';
				 	$('.hy-js-imgtab').append(tab);
				 	$('.hy-js-imgarea').append(html);
				 	
				 });
		</script>

	</body>

</html><?php }} ?>
